package Supermarket;

import java.util.ArrayList;
import java.util.Scanner;

public class AddGoods extends Goods{
    ArrayList<Goods> goods=new ArrayList<>();
    Scanner scanner=new Scanner(System.in);
    AddGoods(){}
    void add(){
        System.out.print("输入商品名字：");
        name=scanner.next();
        System.out.print("输入商品价格：");
        price=scanner.nextDouble();
    }
    void AddV(){
        add();
        System.out.println("输入商品是否今天：1.Y 2.N");
        int i=scanner.nextInt();
        boolean today=(i == 1);
        goods.add(goods.size(),new Vegetable(today,name,price));
        //Show();
    }
    void AddM(){
        add();
        goods.add(goods.size(),new meat(name,price));
        //Show();
    }
    void Show(){
        for(Goods good:goods){
            System.out.println(good.name+"\t"+good.price);
        }
    }
}
